package cn.itsource.easyexcel.write;

import cn.itsource.constant.Constant;
import cn.itsource.vo.User3;
import com.alibaba.excel.EasyExcel;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * 复杂表头的写入
 */
public class WriteDemo6 {
    public static void main(String[] args) {
        String filename = Constant.BATH_URL + "user6.xlsx";
        List<User3> users = new ArrayList<>();
        for (int i = 1; i <= 10; i++) {
            User3 user = User3.builder()
                    .userId(i)
                    .userName("大哥" + i)
                    .hireDate(new Date())
                    .build();
            users.add(user);
        }
        // 向Excel中写入数据
        EasyExcel.write(filename, User3.class)
                .sheet("用户信息")
                .doWrite(users);
    }
}
